<template>
  <div>
    <div class="breadcrumb">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>渠道管理</el-breadcrumb-item>
        <el-breadcrumb-item>流量渠道管理</el-breadcrumb-item>
      </el-breadcrumb>
    </div>

    <el-card>
      <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
        <el-tab-pane label="已开启" name="1">
          <el-row style="position: relative">
            <el-col :span="5">
              <el-input
                v-model="seachlist.name"
                placeholder="渠道名称/渠道标识"
              ></el-input>
            </el-col>
            <el-col :span="4">
              <el-select
                v-model="seachlist.platformType"
                placeholder="选择类型"
              >
                <el-option value="" label="选择类型"></el-option>
                <el-option value="CPA" label="CPA"></el-option>
                <el-option value="CPS" label="CPS"></el-option>
                <el-option value="UV" label="UV"></el-option>
              </el-select>
            </el-col>
            <!-- <el-col :span="4">
							<el-select v-model="seachlist.isOpen" placeholder="选择状态">
								<el-option value="" label="选择状态"></el-option>
								<el-option value='1' label="开启"></el-option>
								<el-option value='0' label="关闭"></el-option>
							  </el-select>
						</el-col> -->
            <el-button class="btnprimary" @click="search">搜索</el-button>
            <el-button type="info" plain @click="clear">清空</el-button>
            <el-button
              style="position: absolute; right: 10px"
              class="btnprimary fontsize16"
              @click="goAdd"
              >添加渠道</el-button
            >
          </el-row>
          <div>
            <div
              class="tablebox"
              v-for="(item, index) in MsrketingList"
              :key="index"
            >
              <div class="tablelist" style="border-bottom: 1px solid #e9ebed">
                <div class="tablelist-li">
                  <div class="tablelist-li-tit">{{ item.channelName }}</div>
                  <div class="tablelist-li-txt">名称</div>
                </div>
                <div class="tablelist-li">
                  <div class="tablelist-li-tit">{{ item.channelCode }}</div>
                  <div class="tablelist-li-txt">标识</div>
                </div>
                <div class="tablelist-li">
                  <div class="tablelist-li-tit">{{ item.settleType }}</div>
                  <div class="tablelist-li-txt">计费方式</div>
                </div>
                <div class="tablelist-li">
                  <div class="tablelist-li-tit">{{ item.platformType }}</div>
                  <div class="tablelist-li-txt">合作方式</div>
                </div>
                <div class="tablelist-li">
                  <div class="tablelist-li-tit">{{ item.updateUser }}</div>
                  <div class="tablelist-li-txt">最后编辑人</div>
                </div>
                <div class="tablelist-li">
                  <div class="tablelist-li-tit" style="font-size: 13px">
                    {{ item.updateTime }}
                  </div>
                  <div class="tablelist-li-txt">最后修改时间</div>
                </div>
                <div class="tablelist-li">
                  <el-switch
                    v-model="item.isOpen"
                    @change="changeType(item.channelCode, item)"
                    active-color="#13ce66"
                    inactive-color="#ff4949"
                  >
                  </el-switch>
                </div>
                <div class="tablelist-li">
                  <el-button
                    @click="showLoanMarket(item.channelCode)"
                    class="btnprimary btnsmall"
                    size="mini"
                    >渠道租超</el-button
                  >
                  <el-button
                    @click="showData(item.channelCode)"
                    class="btnprimary btnsmall"
                    size="mini"
                    >查看</el-button
                  >
                </div>
                <div class="tablelist-li">
                  <el-button
                    @click="showEdit(item.channelCode)"
                    class="btnprimary btnsmall"
                    size="mini"
                    >编辑</el-button
                  >
                </div>
              </div>
              <div class="tablelist">
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">{{ item.totalPv }}</div>
                    <div class="tablelist-li-txt">今日PV</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.pv.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.pv.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.pv.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">{{ item.totalIp }}</div>
                    <div class="tablelist-li-txt">今日IP</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.ip.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.ip.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.ip.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">
                      {{ item.totalRegister
                      }}{{
                        item.registerRate == "0"
                          ? ""
                          : "(" + item.registerRate + ")"
                      }}
                    </div>
                    <div class="tablelist-li-txt">今日注册</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.register.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.register.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.register.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in tablelist-li-bot-inw">
                    <div class="tablelist-li-tit">
                      {{ item.isKl ? "已开启" : "未开启" }}
                    </div>
                    <div class="tablelist-li-txt">扣量</div>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">{{ item.totalDownload }}</div>
                    <div class="tablelist-li-txt">下载量</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.download.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.download.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.download.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">
                      {{ item.totalLogin
                      }}{{
                        item.loginRate == "0" ? "" : "(" + item.loginRate + ")"
                      }}
                    </div>
                    <div class="tablelist-li-txt">登录量</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.login.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.login.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.login.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">
                      {{ item.totalNewUser
                      }}{{
                        item.newUserRate == "0"
                          ? ""
                          : "(" + item.newUserRate + ")"
                      }}
                    </div>
                    <div class="tablelist-li-txt">新用户</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.newUser.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.newUser.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.newUser.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">{{ item.totalOldUser }}</div>
                    <div class="tablelist-li-txt">老用户</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.oldUser.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.oldUser.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.oldUser.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">
                      {{ item.totalLoanMarketIp
                      }}{{
                        item.loanMarketIpRate == "0"
                          ? ""
                          : "(" + item.loanMarketIpRate + ")"
                      }}
                    </div>
                    <div class="tablelist-li-txt">贷超总IP</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.loanMarketIp.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.loanMarketIp.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.loanMarketIp.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in tablelist-li-bot-inw">
                    <div class="tablelist-li-tit">{{ item.singleAmt }}</div>
                    <div class="tablelist-li-txt">单价</div>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in tablelist-li-bot-inw">
                    <div class="tablelist-li-tit">{{ item.totalAmt }}</div>
                    <div class="tablelist-li-txt">今日产值（元）</div>
                  </div>
                </div>
              </div>
            </div>
          </div>

          <!-- 分页 -->
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="channellist.pageCount"
            :page-size="channellist.pageSize"
            background
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
          >
          </el-pagination>
        </el-tab-pane>

        <el-tab-pane label="未开启" name="2">
          <el-row style="position: relative">
            <el-col :span="5">
              <el-input
                v-model="seachlist1.name"
                placeholder="渠道名称/渠道标识"
              ></el-input>
            </el-col>
            <el-col :span="4">
              <el-select
                v-model="seachlist1.platformType"
                placeholder="选择类型"
              >
                <el-option value="" label="选择类型"></el-option>
                <el-option value="CPA" label="CPA"></el-option>
                <el-option value="CPS" label="CPS"></el-option>
                <el-option value="UV" label="UV"></el-option>
                <el-option value="CPA+CPS" label="CPA+CPS"></el-option>
              </el-select>
            </el-col>
            <el-button class="btnprimary" @click="search1">搜索</el-button>
            <el-button type="info" plain @click="clear1">清空</el-button>
            <el-button
              style="position: absolute; right: 10px"
              class="btnprimary fontsize16"
              @click="goAdd"
              >添加渠道</el-button
            >
            <el-button class="btnprimary fontsize16" @click="initdata"
              >初始化</el-button
            >
          </el-row>
          <div>
            <div
              class="tablebox"
              v-for="(item, index) in MsrketingList1"
              :key="index"
            >
              <div class="tablelist" style="border-bottom: 1px solid #e9ebed">
                <div class="tablelist-li">
                  <div class="tablelist-li-tit">{{ item.channelName }}</div>
                  <div class="tablelist-li-txt">名称</div>
                </div>
                <div class="tablelist-li">
                  <div class="tablelist-li-tit">{{ item.channelCode }}</div>
                  <div class="tablelist-li-txt">标识</div>
                </div>
                <div class="tablelist-li">
                  <div class="tablelist-li-tit">{{ item.settleType }}</div>
                  <div class="tablelist-li-txt">计费方式</div>
                </div>
                <div class="tablelist-li">
                  <div class="tablelist-li-tit">{{ item.platformType }}</div>
                  <div class="tablelist-li-txt">合作方式</div>
                </div>
                <div class="tablelist-li">
                  <div class="tablelist-li-tit">{{ item.updateUser }}</div>
                  <div class="tablelist-li-txt">最后编辑人</div>
                </div>
                <div class="tablelist-li">
                  <div class="tablelist-li-tit" style="font-size: 13px">
                    {{ item.updateTime }}
                  </div>
                  <div class="tablelist-li-txt">最后修改时间</div>
                </div>
                <div class="tablelist-li">
                  <el-switch
                    v-model="item.isOpen"
                    @change="changeType(item.channelCode, item)"
                    active-color="#13ce66"
                    inactive-color="#ff4949"
                  >
                  </el-switch>
                </div>
                <div class="tablelist-li">
                  <el-button
                    @click="showLoanMarket(item.channelCode)"
                    class="btnprimary btnsmall"
                    size="mini"
                    >渠道租超</el-button
                  >
                  <el-button
                    @click="showData(item.channelCode)"
                    class="btnprimary btnsmall"
                    size="mini"
                    >查看</el-button
                  >
                </div>
                <div class="tablelist-li">
                  <el-button
                    @click="showEdit(item.channelCode)"
                    class="btnprimary btnsmall"
                    size="mini"
                    >编辑</el-button
                  >
                </div>
              </div>
              <div class="tablelist">
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">{{ item.totalPv }}</div>
                    <div class="tablelist-li-txt">今日PV</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.pv.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.pv.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.pv.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">{{ item.totalIp }}</div>
                    <div class="tablelist-li-txt">今日IP</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.ip.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.ip.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.ip.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">
                      {{ item.totalRegister
                      }}{{
                        item.registerRate == "0"
                          ? ""
                          : "(" + item.registerRate + ")"
                      }}
                    </div>
                    <div class="tablelist-li-txt">今日注册</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.register.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.register.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.register.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in tablelist-li-bot-inw">
                    <div class="tablelist-li-tit">
                      {{ item.isKl ? "已开启" : "未开启" }}
                    </div>
                    <div class="tablelist-li-txt">扣量</div>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">{{ item.totalDownload }}</div>
                    <div class="tablelist-li-txt">下载量</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.download.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.download.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.download.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">
                      {{ item.totalLogin
                      }}{{
                        item.loginRate == "0" ? "" : "(" + item.loginRate + ")"
                      }}
                    </div>
                    <div class="tablelist-li-txt">登录量</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.login.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.login.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.login.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">
                      {{ item.totalNewUser
                      }}{{
                        item.newUserRate == "0"
                          ? ""
                          : "(" + item.newUserRate + ")"
                      }}
                    </div>
                    <div class="tablelist-li-txt">新用户</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.newUser.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.newUser.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.newUser.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">{{ item.totalOldUser }}</div>
                    <div class="tablelist-li-txt">老用户</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.oldUser.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.oldUser.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.oldUser.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in">
                    <div class="tablelist-li-tit">
                      {{ item.totalLoanMarketIp
                      }}{{
                        item.loanMarketIpRate == "0"
                          ? ""
                          : "(" + item.loanMarketIpRate + ")"
                      }}
                    </div>
                    <div class="tablelist-li-txt">贷超总IP</div>
                  </div>
                  <div class="tablelist-li-bot-out">
                    <p>
                      安卓：<span>{{ item.loanMarketIp.android }}</span>
                    </p>
                    <p>
                      IOS：<span>{{ item.loanMarketIp.ios }}</span>
                    </p>
                    <p>
                      其他：<span>{{ item.loanMarketIp.other }}</span>
                    </p>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in tablelist-li-bot-inw">
                    <div class="tablelist-li-tit">{{ item.singleAmt }}</div>
                    <div class="tablelist-li-txt">单价</div>
                  </div>
                </div>
                <div class="tablelist-li-bot">
                  <div class="tablelist-li-bot-in tablelist-li-bot-inw">
                    <div class="tablelist-li-tit">{{ item.totalAmt }}</div>
                    <div class="tablelist-li-txt">今日产值（元）</div>
                  </div>
                </div>
              </div>
            </div>
          </div>

          <!-- 分页 -->
          <el-pagination
            @size-change="handleSizeChange1"
            @current-change="handleCurrentChange1"
            :current-page="channellist1.pageCount"
            :page-size="channellist1.pageSize"
            background
            layout="total, sizes, prev, pager, next, jumper"
            :total="total1"
          >
          </el-pagination>
        </el-tab-pane>
      </el-tabs>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      seachlist: {
        name: "",
        platformType: "",
        channelCode: "",
        channelName: "",
      },
      seachlist1: {
        name: "",
        platformType: "",
        channelCode: "",
        channelName: "",
      },
      activeName: "1",
      total: 0,
      total1: 0,
      MsrketingList: [],
      MsrketingList1: [],
      channellist: {
        pageSize: 10,
        pageCount: 1,
        isOpen: "1",
      },
      channellist1: {
        pageSize: 10,
        pageCount: 1,
        isOpen: "0",
      },
      isFirstEnter: false,
    };
  },
  created() {
    // this.getList()
    // this.getList1()
  },
  beforeRouteEnter(to, from, next) {
    if (from.path == "/marketingData" || from.path == "/marketingEdit") {
      to.meta.isBack = true;
    }
    next();
  },
  activated() {
    if (!this.$route.meta.isBack || this.isFirstEnter) {
      this.channellist = { pageSize: 10, pageCount: 1, isOpen: "1" };
      this.channellist1 = { pageSize: 10, pageCount: 1, isOpen: "0" };
      this.total = 0;
      this.total1 = 0;
      this.activeName = "1";
      this.seachlist = {
        name: "",
        platformType: "",
        channelCode: "",
        channelName: "",
      };
      this.seachlist1 = {
        name: "",
        platformType: "",
        channelCode: "",
        channelName: "",
      };
      this.MsrketingList = [];
      this.MsrketingList1 = [];
      this.getList();
      this.getList1();
    } else {
      this.getList();
      this.getList1();
    }
    this.$route.meta.isBack = false;
    this.isFirstEnter = false;
  },
  methods: {
    clear() {
      this.seachlist = {
        name: "",
        platformType: "",
        channelCode: "",
        channelName: "",
      };
      this.search();
    },
    clear1() {
      this.seachlist1 = {
        name: "",
        platformType: "",
        channelCode: "",
        channelName: "",
      };
      this.search1();
    },
    async getList() {
      const loading = this.$loading({
        lock: true,
        text: "Loading",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      const { data: res } = await this.$http.post(
        "/outLinkChannel/list",
        this.channellist
      );
      setTimeout(() => {
        loading.close();
      }, 500);
      console.log(res);
      this.total = res.data.total;
      this.MsrketingList = res.data.records;
      this.MsrketingList.forEach((item, index) => {
        for (let k in item) {
          if (item[k] === "" || item[k] === null) {
            item[k] = "-";
          }
        }
      });
    },
    async getList1() {
      const loading = this.$loading({
        lock: true,
        text: "Loading",
        spinner: "el-icon-loading",
        background: "rgba(0, 0, 0, 0.7)",
      });
      const { data: res } = await this.$http.post(
        "/outLinkChannel/list",
        this.channellist1
      );
      setTimeout(() => {
        loading.close();
      }, 500);
      console.log(res);
      this.total1 = res.data.total;
      this.MsrketingList1 = res.data.records;
      this.MsrketingList1.forEach((item, index) => {
        for (let k in item) {
          if (item[k] === "" || item[k] === null) {
            item[k] = "-";
          }
        }
      });
    },
    search() {
      this.seachlist.channelName = "";
      this.seachlist.channelCode = "";
      if (/^[\u4e00-\u9fa5]{1}/.test(this.seachlist.name)) {
        /* 汉字 */
        this.seachlist.channelName = this.seachlist.name;
      } else {
        /* 为id */
        this.seachlist.channelCode = this.seachlist.name;
      }

      if (this.seachlist.channelCode == "") {
        this.$delete(this.channellist, "channelCode");
      } else {
        this.$set(this.channellist, "channelCode", this.seachlist.channelCode);
      }

      if (this.seachlist.channelName == "") {
        this.$delete(this.channellist, "channelName");
      } else {
        this.$set(this.channellist, "channelName", this.seachlist.channelName);
      }
      if (this.seachlist.platformType == "") {
        this.$delete(this.channellist, "platformType");
      } else {
        this.$set(
          this.channellist,
          "platformType",
          this.seachlist.platformType
        );
      }
      // if(this.seachlist.isOpen == ''){
      // 	this.$delete(this.channellist,'isOpen')
      // }else{
      // 	this.$set(this.channellist,'isOpen',this.seachlist.isOpen)
      // }
      this.getList();
    },
    search1() {
      this.seachlist1.channelName = "";
      this.seachlist1.channelCode = "";
      if (/^[\u4e00-\u9fa5]{1}/.test(this.seachlist1.name)) {
        /* 汉字 */
        this.seachlist1.channelName = this.seachlist1.name;
      } else {
        /* 为id */
        this.seachlist1.channelCode = this.seachlist1.name;
      }

      if (this.seachlist1.channelCode == "") {
        this.$delete(this.channellist1, "channelCode");
      } else {
        this.$set(
          this.channellist1,
          "channelCode",
          this.seachlist1.channelCode
        );
      }

      if (this.seachlist1.channelName == "") {
        this.$delete(this.channellist1, "channelName");
      } else {
        this.$set(
          this.channellist1,
          "channelName",
          this.seachlist1.channelName
        );
      }
      if (this.seachlist1.platformType == "") {
        this.$delete(this.channellist1, "platformType");
      } else {
        this.$set(
          this.channellist1,
          "platformType",
          this.seachlist1.platformType
        );
      }
      // if(this.seachlist.isOpen == ''){
      // 	this.$delete(this.channellist,'isOpen')
      // }else{
      // 	this.$set(this.channellist,'isOpen',this.seachlist.isOpen)
      // }
      this.getList1();
    },
    handleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
      this.channellist.pageSize = val;
      this.getList();
    },
    handleSizeChange1(val) {
      // console.log(`每页 ${val} 条`);
      this.channellist.pageSize = val;
      this.getList1();
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
      this.channellist.pageCount = val;
      this.getList();
    },
    handleCurrentChange1(val) {
      // console.log(`当前页: ${val}`);
      this.channellist1.pageCount = val;
      this.getList1();
    },
    goAdd() {
      this.$router.push({ path: "/marketingAdd" });
    },
    async initdata() {
      const { data: res } = await this.$http.post(
        "/loanMarket/initLoanMarketChannelData",
        {}
      );
      if (res.code !== 200) {
        return this.$message.error("初始化失败");
      }
      this.$message.success("初始化成功");
    },
    async changeType(id, info) {
      var open = "";
      if (info.isOpen) {
        open = 1;
      } else {
        open = 0;
      }
      const { data: res } = await this.$http.post(
        "/outLinkChannel/updateChannelType",
        { channelCode: id, isOpen: open }
      );
      if (res.code !== 200) {
        info.isOpen = !info.isOpen;
        return this.$message.error("修改状态失败");
      }
      this.$message.success("修改状态成功");
    },
    showEdit(id) {
      this.$router.push({ path: "/marketingEdit", query: { channelCode: id } });
    },
    showData(id) {
      this.$router.push({ path: "/marketingData", query: { channelCode: id } });
    },
    showLoanMarket(id) {
      this.$router.push({
        path: "/loanMarketChannel",
        query: { channelCode: id },
      });
    },
    handleClick() {
      // console.log(this.activeName);
    },
  },
};
</script>

<style lang="less" scoped>
.el-card {
  margin-top: 10px;
}
.el-col {
  margin-right: 10px;
}
.tablebox {
  padding: 0 16px;
  height: 241px;
  background: #ffffff;
  border-radius: 4px;
  border: 1px solid #dddddd;
  margin-top: 16px;
  .tablelist {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .tablelist-li {
      width: 11%;
      // height: 88px;
      text-align: center;
    }

    .tablelist-li-bot {
      width: 9%;
      height: 88px;
      text-align: center;
      // cursor: pointer;
      .tablelist-li-bot-in {
        width: 100%;
        padding-top: 22px;
      }
      .tablelist-li-bot-out {
        display: none;
        padding-top: 15px;
        p {
          margin: 0;
          margin-bottom: 2px;
          font-size: 12px;
          color: #333333;
          span {
            color: #3878ea;
          }
        }
      }
    }
    .tablelist-li-bot:hover {
      box-shadow: 0px 6px 10px 0px rgba(56, 120, 234, 0.16);
      border-radius: 4px;
      border: 1px solid #3878ea;
      .tablelist-li-bot-in {
        display: none;
      }
      .tablelist-li-bot-inw {
        display: block;
      }
      .tablelist-li-bot-out {
        display: block;
      }
    }
  }
}
.tablelist-li-tit {
  font-size: 16px;
  color: #3878ea;
  margin-bottom: 4px;
}
.tablelist-li-txt {
  font-size: 12px;
  color: #333333;
}
</style>
